import request from '@/utils/request'
import { getToken } from '@/utils/token'

// 封装登录接口

export function login (data) {
  return request({
    url: '/v1_0/authorizations',
    method: 'post',
    data
  })
}

//  封装用户的频道
export function channelsList () {
  return request({
    url: '/v1_0/user/channels',
    Authorization: `Bearer ${getToken()}`
  })
}

//  封装新闻推荐列表
export const articlesListAPI = ({ channelId }) => {
  return request({
    url: '/v1_0/articles',
    params: {
      channel_id: channelId,
      timestamp: (new Date()).getTime()
    }
  })
}
